import Vue from 'vue'
import App from './views/App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'
import { ShareSheet,Form, Field, Button, Toast, Tabbar, TabbarItem, Tab, Tabs, NavBar, Icon, Cell, List, PullRefresh, ActionSheet, Notify, Popup, Col, Row, Badge, Search, Tag, Image as VanImage, Divider, Dialog, Empty, Uploader, DatetimePicker } from 'vant'

Vue.use(Form)
Vue.use(Field)
Vue.use(Button)
Vue.use(Toast)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(NavBar)
Vue.use(Icon)
Vue.use(Cell)
Vue.use(List)
Vue.use(PullRefresh)
Vue.use(ActionSheet)
Vue.use(Notify)
Vue.use(Popup)
Vue.use(Col)
Vue.use(Row)
Vue.use(Badge)
Vue.use(Search)
Vue.use(Tag)
Vue.use(VanImage)
Vue.use(Divider)
Vue.use(Dialog)
Vue.use(Empty)
Vue.use(Uploader)
Vue.use(DatetimePicker)
Vue.use(ShareSheet);
// 封装中间件函数插件
const directiveObj = {
  install (Vue) {
    Vue.directive('searchFocus', {
      inserted (el) {
        if (el.nodeName === 'INPUT') {
          el.focus()
        } else {
          setTimeout(() => {
            const theInput = el.querySelector('input')
            theInput.focus()
          }, 0)
        }
      }
    })
  }
}
Vue.use(directiveObj)

Vue.config.productionTip = false
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
